package com.web.config;

import com.jfinal.config.Constants;
import com.jfinal.config.Handlers;
import com.jfinal.config.Interceptors;
import com.jfinal.config.Plugins;
import com.jfinal.config.Routes;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.jfinal.plugin.c3p0.C3p0Plugin;
import com.web.controller.IndexController;
import com.web.controller.SystemUserController;
import com.web.mapper.SystemUser;

public class JFinalConfig extends com.jfinal.config.JFinalConfig {

	public void configConstant(Constants constants) {
		constants.setDevMode(true);
	}
	public void configHandler(Handlers handlers) {

	}
	//接口
	public void configInterceptor(Interceptors interceptors) {

	}
	public void configPlugin(Plugins plugins) {
		String url = "jdbc:mysql://localhost:3306/lmhy";
		String user = "root";
		String password = "123456";
		C3p0Plugin c3p0 = new C3p0Plugin(url,user,password);
		plugins.add(c3p0);
		ActiveRecordPlugin arp = new ActiveRecordPlugin(c3p0);
		plugins.add(arp);
		arp.addMapping("SYSTEM_USER", SystemUser.class);
	}
	public void configRoute(Routes routes) {
		routes.add("/",IndexController.class,"/WEB-INF/templates/index");
		routes.add("/user",SystemUserController.class,"/WEB-INF/templates/user");
	}

}
